package edu.kpi.pzks2.simulator.results;

import java.util.ArrayList;
import java.util.List;

/**
 * Processor or link history time line.
 *
 * @author Pustovit Michael, pustovitm@gmail.com
 */
public class TimeLine {
    private Object title;
    private List<HistoryBean> intervals;
    
    public TimeLine(Object title) {
        super();
        this.title = title;
        intervals = new ArrayList<HistoryBean>();
    }

    public String getTitle() {
        return title.toString();
    }

    public Object getTitleObject() {
        return title;
    }
    
    public List<HistoryBean> getIntervals() {
        return intervals;
    }
    
    public void addBean(final HistoryBean bean) {
        intervals.add(bean);
    }
    
    @Override
    public String toString() {
        String str = "";//title;
        
        for (HistoryBean b : intervals) {
            if (b == null) {
                str += "_";
            } else {
                if (b instanceof ProcHistoryBean) {
                    str += ((ProcHistoryBean) b).getTaskId() + "";
                } else {
//                    final boolean toA = ((ChannelHistoryBean) b).getMsgAtoBId() >= 0;
//                    final boolean toB = ((ChannelHistoryBean) b).getMsgBtoAId() >= 0;
//                    str += (toA && toB) ? "=" : "-";
                    str += "#";
                }
            }
        }
        
        return str;
    }
}
